recurring\re-use of DBE in dialog box

Dear Doors Guru's,

I got stuck with dialog box creation:
Want to create a say 8 frames containing 4 text boxes each. (The layout data are read from an XML.)
I want to reuse the DBEs when recurring through the frames.

if(AttributeIterator_i == 0)
{
objValue = setValues(obj,AttributeName_s)
dbeTestRunNum0 = richText(dbCreateTestExecution, AttributeFieldName_s, objValue ,AttributeWidth_i,Height_i,AttributeReadOnly_b)
dbeTestRunNum0 -> "bottom" -> "inside" -> FrameName_s
dbeTestRunNum0 -> "top" -> "inside" -> FrameName_s
dbeTestRunNum0 -> "right" -> "unattached"
dbeTestRunNum0 -> "left" -> "inside" -> FrameName_s

}
.
.
.
if(AttributeIterator_i == 3)
{
objValue = setValues(obj,AttributeName_s)
dbeTestRunNum3 = richText(dbCreateTestExecution, AttributeFieldName_s, objValue ,AttributeWidth_i,Height_i, AttributeReadOnly_b)
dbeTestRunNum3 -> "left" -> "spaced" -> dbeTestRunNum2
dbeTestRunNum3 -> "bottom" -> "inside" -> FrameName_s
dbeTestRunNum3 -> "top" -> "inside" -> FrameName_s
dbeTestRunNum3 -> "right" -> "unattached"
objValue = setValues(obj,AttributeName_s)
//set(dbeTestRunNum3,sObjValue)
}

Regarding the layout of the box it works fine.

Problem:
I want to get the textbox populated values for all the DBE elements.
But I get only the values for the last initialized DBE elements.

Could anyone help me in getting the DBE element list? Is there any unique ID for the DBE elements and I can access the DBE elements with its unique ID (like "dbeTestRunNum_i")?
Is there any possibility of renaming the DBE element after initializing.
Ranjeetha - Thu Feb 03 01:53:51 EST 2011

Re: recurring\re-use of DBE in dialog box
Mathias Mamsch - Thu Feb 03 19:16:02 EST 2011

Put all the elements and their infos in skip lists, that you can use to access the elements in callbacks or from the scripts. I used the below code in a script, to do exactly the task you described (I put a button left of each text field and read from a config module). I hope it gives you the idea:
 

DBE lastDBE = null
int fieldCount = 0
Skip skFieldTabs = create()
int dialogHeight = 0;
 
void addField (string lab, string typ, string aName) {
    DBE ed
        AttrDef ad = find (mod, aName)
 
        // last DBE remembers the last field that we added, so we can put the next one below it
        // If we reach the ELEMENTS_PER_PAGE count, we will reset, so we can start a new page
        if (fieldCount % ELEMENTS_PER_PAGE == 0) lastDBE = null
        
        // Put a label  
        DBE dbeLb = label(modInfo, lab)
        put (skFieldTabs, dbeLb, fieldCount / ELEMENTS_PER_PAGE)
 
        // position it below the last one or at top of the tab 
        if (null lastDBE) dbeLb->"top"->"inside"->theTab else dbeLb->"top"->"spaced"->lastDBE    
        dbeLb->"left"->"inside"->theTab
 
        // put a 'create' button in there if the attribute is not present
        DBE bt
        if (null ad) {                
                bt = button (modInfo, "Create", createAttr)
                put (skFieldTabs, bt, fieldCount / ELEMENTS_PER_PAGE)
                bt->"right"->"form"
                bt->"left"->"unattached"
                bt->"top"->"aligned"->dbeLb
        }     
 
        // put a dummy label to get a nice space        
        DBE dummy = null
        if (lower typ != "string") {
                dummy = label (modInfo,"")
        put (skFieldTabs, dummy, fieldCount / ELEMENTS_PER_PAGE)
                dummy->"left"->"form"
                dummy->"top"->"spaced"->dbeLb
        }
 
        // put the right kind of edit field, keep track of the dialog height ...
        if lower typ == "richtext" then { ed = richText(modInfo, "", "test", 380,40,false); dialogHeight += 40; }
        if lower typ == "text" then     { ed = text(modInfo, "", "test", 380,40,false); dialogHeight += 40;     }
        if lower typ == "string" then   { ed = field(modInfo, "  ", "", 60);            dialogHeight += 20;     }
 
        // store the field in the skip list
        put (skFieldTabs, ed, fieldCount / ELEMENTS_PER_PAGE)
        
        // position it  
        ed->"top"->"spaced"->dbeLb 
        if (null dummy) ed->"left"->"form" else ed->"left"->"spaced"->dummy
        ed->"right"->"unattached"
        
        // store it as the last DBE, so the next field will come below it 
        lastDBE = ed
        
        // store the attribute and type names 
        put(skAttrs, ed, aName)
        put(skType , ed, typ) 
        
        // associate the buttons with the edit fields, to get the right field in the callback
        if (null ad) put (skButtons, bt, ed)
        dialogHeight += 20
        fieldCount++    
}
 
...
 
// add the fields, they will 
for x in childs(oAttributes) do {
        addField ( x."Object Text" "", x."Variable Type" "", x."Variable Name" "") 
}

 


Regards, Mathias

 

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

 

Re: recurring\re-use of DBE in dialog box
Mathias Mamsch - Thu Feb 03 19:18:42 EST 2011

Oh I just see, that you want to put that in Frames not in Tabs, in this case you need to modify the example code to insert another frame all 4 elements. But I still hope it gives you an idea. Regards, Mathias

Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Re: recurring\re-use of DBE in dialog box
Ranjeetha - Fri Feb 04 01:44:46 EST 2011

Thank you so much Mathias:-)

Your solution worked for me thanks to your hint.
(I have developed a script for creating a dialog box to handle complex inputs to a doors module. XML file is used as a configuration file for complex input.)
Do you think I should post the complete script here?

But anyway, thanks a lot for your superfast help.
Have a nice weekend,
Ranjeetha

Re: recurring\re-use of DBE in dialog box
Mathias Mamsch - Fri Feb 04 03:01:25 EST 2011

Ranjeetha - Fri Feb 04 01:44:46 EST 2011
Thank you so much Mathias:-)

Your solution worked for me thanks to your hint.
(I have developed a script for creating a dialog box to handle complex inputs to a doors module. XML file is used as a configuration file for complex input.)
Do you think I should post the complete script here?

But anyway, thanks a lot for your superfast help.
Have a nice weekend,
Ranjeetha

If you like you can attach the script to a post in a zip file so everybody can benefit from it... Regards, Mathias

Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS